#ifndef HISTREAMER_PLUGIN_INTF_SOURCE_PLUGIN_H
#define HISTREAMER_PLUGIN_INTF_SOURCE_PLUGIN_H

#include <map>
#include <string>
#include "plugin_base.h"
#include "plugin_definition.h"
#include "common/plugin_caps.h"

namespace OHOS {
namespace Multimedia {
namespace Plugin {

struct SourcePlugin : public PluginBase {
    virtual Status SetSource(std::string &uri, std::shared_ptr<std::map<std::string, ValueType>> params = nullptr) = 0;
    virtual Status Read(std::shared_ptr<Buffer> &buffer, size_t expectedLen) = 0;
    virtual Status GetSize(size_t &size) = 0;
    virtual bool IsSeekable() = 0;
    virtual Status SeekTo(uint64_t offset) = 0;
};

#define SOURCE_API_VERSION_MAJOR (1)
#define SOURCE_API_VERSION_MINOR (0)
#define SOURCE_API_VERSION MAKE_VERSION(SOURCE_API_VERSION_MAJOR, SOURCE_API_VERSION_MINOR)

struct SourcePluginDef : public PluginDefBase {
    std::string protocol;
    CapabilitySet outCaps;
    PluginCreatorFunc<SourcePlugin> creator;
    SourcePluginDef() {
        apiVersion = SOURCE_API_VERSION;
        pluginType = PluginType::SOURCE;
    }
};

} // namespace Plugin
} // namespace Multimedia
} // namespace OHOS
#endif
